{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Introduction\n",
    "\n",
    "### 什么是符号运算\n",
    "\n",
    "符号运算(Symbolic computation)专门用来符号化处理数学对象的计算. \n",
    "这意味着, 这些数学对象是精准表示的, 没有估计. 而且这些数学表示还会保留成符号的形式. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\sqrt{3}$"
      ],
      "text/plain": [
       "sqrt(3)"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import sympy \n",
    "sympy.sqrt(3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 2 \\sqrt{2}$"
      ],
      "text/plain": [
       "2*sqrt(2)"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.sqrt(8)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 更多有意思的例子\n",
    "\n",
    "上面的例子对于无理数的运算很有用. 但 Symbolic computation systems 还支持有变量的符号运算表达\n",
    "\n",
    "符号变量用 `symbols` 来定义"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle x + 2 y$"
      ],
      "text/plain": [
       "x + 2*y"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sympy import *\n",
    "x, y = symbols('x y')\n",
    "expr = x + 2 * y \n",
    "expr"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "更多的运算如下"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle x + 2 y + 1$"
      ],
      "text/plain": [
       "x + 2*y + 1"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr + 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 2 y$"
      ],
      "text/plain": [
       "2*y"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr - x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle x \\left(x + 2 y\\right)$"
      ],
      "text/plain": [
       "x*(x + 2*y)"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr * x"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "有时候我们可能需要因式分解的形式, 有时候却想要乘开的形式, `sympy` 也有相应的函数来转换这两种形式. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle x^{2} + 2 x y$"
      ],
      "text/plain": [
       "x**2 + 2*x*y"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expanded_expr = expand(x * expr)\n",
    "expanded_expr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle x \\left(x + 2 y\\right)$"
      ],
      "text/plain": [
       "x*(x + 2*y)"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "factor(expanded_expr)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 符号运算的强大之处\n",
    "\n",
    "符号运算的真正强大之处在于, 符号运算可以做各种各样的计算, 比如: 方差, 积分, 极限, 解方程, 处理矩阵, 等等. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAALsAAAAVCAYAAAAehp/0AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGDUlEQVRoBe2a63EUORCAjYsAAGcAGRxcBGcy4BEBkMFR/ud/V0cGhgyADCADjDM4MjjYDHzfp1NPadYz61nNyt41dFW7NZK61eputR7rW+fn53vrwPHx8Z+5/wPo3+Ar8I5l2r5BtxbQ736tjnN4r8Mg6Luzfgp7zbH5EO9+CJ5CswE/Qt/Q/x54Qvk19BH4G7i1kHWfo6MLJQJoa+epYlnPnfRTGLaFv9YKdhRZoERkb7P5p6zcC+o/hqLrUngNpB/gy3V5p/RH7hP6HUDn6PjZsbKsKcNeZ58mfrqqCbXy11rBjhJviwkfUo4AOCvqa4r3YXLxPKxhXsWDzso9groDzQJkuKMpS5lbC+jXyk/N55xt28RfawV7zBSF0nEAmoIcarBWA/wumrtQz/+bBu8VJxsUqixlVgFzPASb7GDLCjHORv20LL/RdzN/TQ52DJeOGnmCz6FlNp8dpMhfNDLeM2SXmW7WMFmWMmuzu3y1vJfqjl5N/XSpAvM7NPPX7TV0+07fzxjTrJTO6pS9sB2Af4FbB+jnUSvuGJvUT5nPwI0tog0qt3N+irm39lcv2BnMjHME/psV8HnxNfVeeBaUn+Z6STqvF9+jRXjdTg08ZURWe079Q9Aj0AdQ6mJKY2Qe6++B70G3Ny+awu/gF/p4hl4FyhrVE351iSOFMl+A6uHOJTjG0KVWmY/Bawn2rHcLP2kP7ayfAno2yGPb55/cwRj5QH1nZ8qj/g6hI7Spv7pgR0GD0fPoU8pxFldpjVp9uUNWMiDU4OiA73T0gZolDfowXurDtzo8gP6AGvBPKKfghqrXV6jPa6syt0+izmkM/G0g9HCXegfqXBe4fDp1KNjVVXtdOaBXKz+5yL+C3ctaHstA/gaegdrdBPTYOmgCyp9sA9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z9DZteinvHjB5lhC0+rVYayfkFbCzTx10+R2fVLzsqH0Kp/3oLPVwp/DZ61O7SNkZsjvYW//gNrqC5sz9iDDQAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle e^{x} \\sin{\\left(x \\right)} + e^{x} \\cos{\\left(x \\right)}$"
      ],
      "text/plain": [
       " x           x       \n",
       "ℯ ⋅sin(x) + ℯ ⋅cos(x)"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x, t, z, nu = symbols('x t z nu')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "`init_printing` 可以使得输出的结果更加美观"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "init_printing(use_unicode=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "diff(sin(x) * exp(x), x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle e^{x} \\sin{\\left(x \\right)}$"
      ],
      "text/plain": [
       "exp(x)*sin(x)"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "integrate(exp(x) * sin(x) + exp(x) * cos(x), x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{\\sqrt{2} \\sqrt{\\pi}}{2}$"
      ],
      "text/plain": [
       "sqrt(2)*sqrt(pi)/2"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "integrate(sin(x**2), (x, -oo, oo))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 1$"
      ],
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "limit(sin(x) / x, x , 0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAGMAAAAlCAYAAABWOlfkAAAACXBIWXMAAA7EAAAOxAGVKw4bAAADeklEQVRoBe2b71HcMBDFfZkUQNJBoAMgHVwJkFQQ6CBMPt19y5AOoIVQAukgUAIdBOgg+T2P7Wx8tk+eSGsfI81opJPW2tV72l3/gcVqtTopiuI71Zbz9Xp9bQdyPx4CYHvFametFd8sKjI+InDamsw/nRAA+ydUvXvlpC+rCUAgkxEAkpdIJsML6QA9rwNkJhEhjh6i+C5UOfKLUNkUcjHsnS0ZAHZJPWKT9ynAS7Dmf9s7yzBVnbJiV4iIZe8syeDUfqHqpO1KiWLv7MjglO3DwD7t7S4wEdPeOeaMC0hQbUq14XrsmIlH6gXjc8gn0eydlWcA7h4gH9M2XlERcUmrVzSqR8iIhDv6S9rJCvqj2jsrMkBVeeJrC12NfbJjgKDT+Extv1OzYh79qPbOhozqlC1pb1oo6vQ/VfN2St6zx7hyjHtJYe9syADNvjsSgf7A5uUJXUWhYooS3V6XBA6Qek3/TNvkgg70Tpg/aI8z1vc2WU/oBfPRkzhrTmJvcjLY2Gcw0yl6oCr5bpRK5mpjomcAeRGh8FTfYfVIjh+e0t6kYYqNCTB9pFI9rEDsQkh3Sd+6JnrGlLivR17Ts9Tf4antHfQMjFM8/kEdE5dPua4MHbTyhoJWd0i1h/wTdpjTF68xXiHZW647p41aWHNSe7eRoaTZGVrGoMAmlS/kHWe0erouN12toVATpIPryk+VtNGJsPth/UnsTRqm7Abp1++amjjPppUob7T5luzGz0r2gLYhgr6IVShMUdztdSMD0OQNupuSd9RhT4ldIWywIK+E/Z62IbK6QGQ+2ovN2nZ4dJ91XOy1hg2GKSsYqa/TtqSKEG32J+2gVzCvk6+ErTxhc8tbxnRT0CR++iJZD4j31KDQh/xQSWpvW7GbZ0gxAMkzlNzlEap1KKDbW0SECFG+sLV8FrBXsb6IFcl6Mq+9z4qM6qe2t22Mt2dIv8KSANZTtYAbLMiMOuHIK6+IqFglqb3WSFfPkGKA0rsnkdCO/5qOVZRfBsNfqCIne0tzpvAMEbLx2iMUnG1yrK3w9Gub3Jj5lPZaO9w9wypP1P8AeE1ST6QjybIvjgyI2Nm/EX5xZCQ5sk6LZjKcgA5Rk8kIQclJJpPhBHSImkxGCEpOMpkMJ6BD1GQyQlBykqmfwPXHAL+Nzvw/fQaM2F2w1tvn8kOZXfsP3meQjfvcancAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle \\left[ - \\sqrt{2}, \\  \\sqrt{2}\\right]$"
      ],
      "text/plain": [
       "[-√2, √2]"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solve(x**2 - 2, x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle y{\\left(t \\right)} = C_{2} e^{- t} + \\left(C_{1} + \\frac{t}{2}\\right) e^{t}$"
      ],
      "text/plain": [
       "Eq(y(t), C2*exp(-t) + (C1 + t/2)*exp(t))"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y = Function('y')\n",
    "dsolve(Eq(y(t).diff(t, t) - y(t), exp(t)), y(t))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAQsAAAA/CAYAAAD3ye1dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAKrElEQVR4Ae2d65HVOBCFB4oAhg1hyACGCBYygN0IlslgKf7xj4IMYDMAMgAi4JEBZMAjg9nzeSRj+XFt35Hn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DAlUUZPHktHYGDI+DK4uAUeAUcgVUhMPjB55CyiMOcjGR4cAQcge0gENs869AkYUhZ8P8hhLhqzsWR/zoCjoB1BE6CgJ3FgXuVhTzAcUEU5lp4cAQcgQ0goHbPQj90Q3oXb+5VFgGX6ktRFVAvHb8BvFxER2DLCLCEIKH3m65BZSElwZRtJlOxCC/TuD04Ao6AUQTUxlEUtHNW4+e/ZDphUFmEnPxDGQqDP6jBRPHgCDgCxhAIioIexM61Z3q/DWlj0SjsTPHoz2hn82NHwBEoDAG1Z77nwhAYbdtjlkUlugqkS8J07l7zpMrkP46AI1AiAixSdXOKEfA/4yvLMTAnh2AAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle \\left\\{ \\frac{3}{2} - \\frac{\\sqrt{17}}{2} : 1, \\  \\frac{3}{2} + \\frac{\\sqrt{17}}{2} : 1\\right\\}$"
      ],
      "text/plain": [
       "⎧3   √17     3   √17   ⎫\n",
       "⎨─ - ───: 1, ─ + ───: 1⎬\n",
       "⎩2    2      2    2    ⎭"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Matrix([[1, 2], [2, 2]]).eigenvals()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAIIAAAA3CAYAAADABJI7AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAIcUlEQVR4Ae2c/3XUOBDHN3kUwI8OQgcQKiB0AKSCCx3A46/kPx50AFTAgw6ggzvoAEq4pIPc96NIOmkta2XZ6+zanve0suXRzGhmNBp5tXtwfX296gMXFxeP1P9U5XUpHfU5KMVd8MbRwJ0B2LwXjTcy7psBaC0kbkkDvRzBRoOV6l9jyW95/izlJ/zJRR+N6UjlT6kOHF6uXy9HEIO3KkSEMQF+jzWo0ZxvzMFt4qVxswTjBJ0dQX1woOcqH9b5HNTmCCJ2JGJfVT8Oidp2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ncbzNxljbgV95DnCpuoz9a+2xfMdtowPnExlfBanOJI6eGcQQOtn5RObb3Jp8Q3mR2GXOOCMmdgozLi6W/VZsj76qJDJwo4vzAia45/DkZB9B4DEzSEWQojo5X/fOLNXJoaH7r4H4VRWTofHr4RtW7/Tk5R5DR3NrOke3kbxYtDmcHsyA8osNVgMQPecP74NF+X05q1yAj8U6AGUvp9b8L1qwkguQGDqA/SZiaI7COM2PdToA8IAI950ceJdGAJNH8ICQkoP7kCZODSTmCs451BqJCn39+wQn4yVy4FHDd5+dmTsSdqyfpCFbLbgvo3xrKqCX/u+CMhMFdZHFtk30NPen3CDL8aP+74DxlX+spRwRs4qIC//xCNCj955d9tWe13JN2BBmfUM47AZJGinMMXS4QamDSjmAHyjrPDmCMf34JdbtX15N3BEUFXhXzcsknjXtloZGE/Q8+c9uvzjucZwAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle \\frac{\\sqrt{2} \\sqrt{z} j_{\\nu - \\frac{1}{2}}\\left(z\\right)}{\\sqrt{\\pi}}$"
      ],
      "text/plain": [
       "√2⋅√z⋅jn(ν - 1/2, z)\n",
       "────────────────────\n",
       "         √π         "
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "besselj(nu, z).rewrite(jn)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'\\\\int\\\\limits_{0}^{\\\\pi} \\\\cos^{2}{\\\\left(x \\\\right)}\\\\, dx'"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "latex(Integral(cos(x)**2, (x, 0, pi)))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Words\n",
    "\n",
    "| 英文 | 词性 | 中文 | \n",
    "| - | - | - | \n",
    "| irrational | n. | 无理数 | \n",
    "| differential | n. | 微分 | \n",
    "| eigenvalue | n. | 特征向量 | "
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
